package com.example.library.service;

import com.example.library.entity.Reservation;
import com.example.library.entity.User;
import com.example.library.repository.ReservationRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReservationService {

    @Autowired
    private ReservationRepository reservationRepository;

    public List<Reservation> getAllReservations() {
        try {
            return reservationRepository.findAll();
        } catch (Exception e) {
            throw new RuntimeException("无法加载预约历史: " + e.getMessage(), e);
        }
    }

    public List<Reservation> getAllReservationsByUser(User currentUser) {
        return null;
    }

    public void cancelReservation(int id) {
    }

    public void createReservation(Reservation reservation) {
    }

    // 其他方法...
}